using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace tutFuelCellGame.Sprites
{
    public class Sprite
    {
        public  Texture2D Texture { get; private set; }
        public float Scale { get; set; }
        public float Opacity { get; set; }
        public Vector2 Center { get; set; }

        public float Width { get { return Texture.Width * Scale; } }
        public float Height { get { return Texture.Height * Scale; } }

        public Sprite(Texture2D texture)
        {
            Texture = texture;
        }

        public virtual void Draw(SpriteBatch batch)
        {
            var destinationRect = new Rectangle((int) (Center.X - Width /2), (int) (Center.Y - Height /2),
                                                (int) (Width), (int) (Height));

            var color = new Color(Color.White, Opacity);
            batch.Draw(Texture, destinationRect, color);
        }
    }
}